import requests from "@/api/request";


//云函数测试接口
export const testCfc = () => requests({
    url: "/pft_test",
    method: "get"
})

//云函数插入数据测试
export const testAdd = (data) => requests({
    url: "/pft_add",
    method: "post",
    data: data
})

//分页查询所有数据测试
export const testfindAll = (data) => requests({
    url: "/pft_findAll",
    method: "post",
    data: data
})
//条件查询测试
export const testquery = (data) => requests({
    url: "/pft_queryId",
    method: "post",
    data: data
})


//云工程测试接口
export const testCpr = () => requests({
    url: "/api/todo",
    method: "get"
})
// 云工程测试注册
export const register = (localSessionKey, data) => requests({
    url: "/api/user/registerUser",
    // url:"/api/user/createUser",
    method: "post",
    data: data,
    headers: {
        // 请求头中需要设置 x-tt-session-v2，才能在服务端使用用户系统
        'x-tt-session-v2': localSessionKey
    }
})
// 云工程测试登陆
export const login = (localSessionKey, data) => requests({
    url: "/api/user/loginUser",
    method: "post",
    data: data,
    headers: {
        // 请求头中需要设置 x-tt-session-v2，才能在服务端使用用户系统
        'x-tt-session-v2': localSessionKey
    }
})
// 云工程测试退出登陆
export const logout = (localSessionKey) => requests({
    url: "/api/user/logoutUser",
    method: "post",
    headers: {
        // 请求头中需要设置 x-tt-session-v2，才能在服务端使用用户系统
        'x-tt-session-v2': localSessionKey
    }
})

//获取账单列表
export const reqGetBill = (data) => requests({
    url: "/api/Account/queryById",
    method: "post",
    data: data
})
//账单提交
export const commitAcc = (data) => requests({
    url: "/api/Account",
    method: "post",
    data: data
})
//账单编辑
export const editAcc = (data) => requests({
    url: "/api/Account",
    method: "put",
    data: data
})
//删除账单
export const deleteAcc = (id) => requests({
    url: `/api/Account/${id}`,
    method: "delete",
});
//记账查询
export const queryAcc = (id) => requests({
    url: `/api/Account/${id}`,
    method: "get"
})
//攒钱中新增存钱
export const commitRecord = (params) => requests({
    url: "/api/mgRecord",
    method: "post",
    data: params
})
//攒钱计划
export const commitGoal = (params) => requests({
    url: "/api/moneyGoal",
    method: "post",
    data: params
})
//获取攒钱目标列表
export const reqMoneyGoalList = (data) => requests({
    url: "/api/moneyGoal/queryPage",
    method: "post",
    data: data
})
//根据id查询攒钱详情
export const reqMoneyInfo = (id) => requests({
    url: "/api/moneyGoal/" + `${id}`,
    method: "get",

})
//根据id更新攒钱详情
export const editMoney = (data) => requests({
    url: "/api/moneyGoal/",
    method: "put",
    data: data

})
//图表攒钱类型金额
export const getMoneyLeixing = (mg_id) => requests({
    url: `/api/mgRecord/getGroupDescPrice/${mg_id}`,
    method: "get",
})
//图表耗时
export const getMoneyTime = (mg_id) => requests({
    url: `/api/mgRecord/getGroupDescDay/${mg_id}`,
    method: "get",
})
// 文件(图片)上传
export const picUpdate = () => requests({
    url: `/api/file/upload/`,
    method: "post",
})
// 新增笔记
export const addNote = (data) => requests({
    url: "/api/Note",
    method: "post",
    data: data,
    headers: {
        // 请求头中需要设置 x-tt-session-v2，才能在服务端使用用户系统
        'Content-Type': 'application/json'
    }
})
// 查看所有笔记
export const searchAllNote = () => requests({
    url: "/api/Note",
    method: "get",
})
// 删除笔记
export const deleteNote = (id) => requests({
    url: `/api/Note/${id}`,
    method: "delete",
})
// 根据id查询笔记
export const selectNoteById = (id) => requests({
    url: `/api/Note/${id}`,
    method: "get",
})
// 根据id更新笔记内容
export const updateNoteById = (data) => requests({
    url: "/api/Note",
    method: "put",
    data,
})
// 查询某个用户的笔记(分页)
export const selectNoteByUserId = (data) => requests({
    url: "/api/Note/queryById",
    method: "post",
    data,
})
//支出方式
export const getzcfs = (info_id) => requests({
    url: "/api/Account/getGroupPaymentExpenditurePrice/"+`${info_id}`,
    method: "get",
})
//支出类别
export const getzclb = (info_id) => requests({
    url: "/api/Account/getGroupTypeExpenditurePrice/"+`${info_id}`,
    method: "get",
})
//收入类别
export const getsrlb = (info_id) => requests({
    url: "/api/Account/getGroupTypeIncomePrice/"+`${info_id}`,
    method: "get",
})
//收入方式
export const getsrfs = (info_id) => requests({
    url: "/api/Account/getGroupPaymentIncomePrice/"+`${info_id}`,
    method: "get",
})
//总收支
export const getSz = (info_id) => requests({
    url: "/api/Account/getUserPrice/"+`${info_id}`,
    method: "get",
})
//攒钱耗时
export const zqhs = (mg_id) => requests({
    url: "/api/mgRecord/getGroupDescDay/"+`${mg_id}`,
    method: "get",
})

// 新增今日计划
export const addtoDayPlan = (data) => requests({
    url: "/api/todayPlan",
    method: "post",
    data: data,
    headers: {
        // 请求头中需要设置 x-tt-session-v2，才能在服务端使用用户系统
        'Content-Type': 'application/json'
    }
})
// 根据id更新今日计划
export const updatetoDayPlanbyId = (data) => requests({
    url: "/api/todayPlan",
    method: "put",
    data: data,
    headers: {
        // 请求头中需要设置 x-tt-session-v2，才能在服务端使用用户系统
        'Content-Type': 'application/json'
    }
})
// 根据id删除攒钱计划(实则修改isDelete状态）
export const deletetoDayPlan = (id) => requests({
    url: `/api/todayPlan/${id}`,
    method: "delete"
})
// 查询指定用户的今日计划(含复盘）（分页）
export const selecttoDayPlanByUserId = (data) => requests({
    url: `/api/todayPlan/queryPage`,
    method: "post",
    data: data
})